// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout, WebLayout, MainLayout, TuiLayout } from '@/layouts'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'admin',
    component: MainLayout,
    meta: { title: '会员中心' },
    redirect: '/admin/member',
    children: [
      {
        path: '/admin/member',
        name: 'member',
        redirect: '/admin/member/home',
        component: RouteView,
        meta: { title: '首页', icon: 'home' },
        children: [
          {
            path: '/admin/member/home',
            name: 'MemberIndex',
            component: () => import('@/views/member/index'),
            meta: { title: '个人中心' }
          }
        ]
      },
      {
        path: '/admin/order',
        name: 'order',
        redirect: '/admin/order/list',
        component: RouteView,
        meta: { title: '订单中心', icon: 'safety-certificate' },
        children: [
          {
            path: '/admin/order/list',
            name: 'OrderList',
            component: () => import('@/views/order/OrderList'),
            meta: { title: '我的订单' }
          },
          {
            path: '/admin/order/detail',
            name: 'OrderDetail',
            hidden: true,
            component: () => import('@/views/order/OrderDetail'),
            meta: { title: '订单详情' }
          }
        ]
      },
      {
        path: '/admin/account',
        name: 'account',
        redirect: '/admin/account/my',
        component: RouteView,
        meta: { title: '账户信息', icon: 'idcard' },
        children: [
          {
            path: '/admin/account/my',
            name: 'Account',
            component: () => import('@/views/my/Account'),
            meta: { title: '个人资料' }
          }
        ]
      },
      {
        path: '/admin/refund',
        name: 'refund',
        redirect: '/admin/refund/list',
        component: RouteView,
        meta: { title: '退款管理', icon: 'account-book' },
        children: [
          {
            path: '/admin/refund/list',
            name: 'RefundList',
            component: () => import('@/views/refund/RefundList'),
            meta: { title: '我的退款单' }
          }
        ]
      },
      {
        path: '/admin/invoice',
        name: 'invoice',
        redirect: '/admin/invoice/list',
        component: RouteView,
        meta: { title: '发票管理', icon: 'account-book' },
        children: [
          {
            path: '/admin/invoice/list',
            name: 'InvoiceList',
            component: () => import('@/views/invoice/InvoiceList'),
            meta: { title: '我的发票' }
          },
          {
            path: '/admin/invoice/title',
            name: 'InvoiceTitle',
            component: () => import('@/views/invoice/InvoiceTitle'),
            meta: { title: '抬头管理' }
          }
        ]
      },
      {
        path: '/admin/complaint',
        name: 'complaint',
        redirect: '/complaint/list',
        component: RouteView,
        meta: { title: '服务中心', icon: 'account-book' },
        children: [
          {
            path: '/admin/complaint/list',
            name: 'ComplaintList',
            component: () => import('@/views/complaint/ComplaintList'),
            meta: { title: '投诉列表' }
          },
          {
            path: '/admin/complaint/add',
            name: 'AddComplaint',
            hidden: true,
            component: () => import('@/views/complaint/AddComplaint'),
            meta: { title: '添加投诉与建议' }
          }
        ]
      },
      {
        path: '/admin/collect',
        name: 'collect',
        redirect: '/collect/list',
        component: RouteView,
        meta: { title: '收藏夹', icon: 'account-book' },
        children: [
          {
            path: '/admin/collect/list',
            name: 'CollectList',
            component: () => import('@/views/collect/CollectList'),
            meta: { title: '收藏列表' }
          }
        ]
      },
      {
        path: '/admin/message',
        name: 'message',
        redirect: '/admin/message/order-list',
        component: RouteView,
        meta: { title: '消息中心', icon: 'message' },
        children: [
          {
            path: '/admin/message/order-list',
            name: 'OrderMessage',
            component: () => import('@/views/message/OrderMessage'),
            meta: { title: '订单消息' }
          },
          {
            path: '/admin/collect/coupon-list',
            name: 'CouponMessage',
            component: () => import('@/views/message/CouponMessage'),
            meta: { title: '优惠消息' }
          }
        ]
      }
    ]
  },
  {
    path: '/admin/cart',
    name: 'cart',
    component: BlankLayout,
    meta: { title: '购物车' },
    redirect: '/admin/cart/list',
    children: [
      {
        path: '/admin/cart/list',
        name: 'Cart',
        component: () => import('@/views/cart/Cart'),
        meta: { title: '我的购物车' }
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    redirect: '/user/login',
    component: UserLayout,
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        meta: { title: '登陆' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      }
    ]
  },
  {
    path: '/add',
    redirect: '/add/category',
    component: BlankLayout,
    hidden: true,
    children: [
      {
        path: '/add/category',
        name: 'AddCategory',
        meta: { title: '添加分类' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/add/AddCategory')
      },
      {
        path: '/add/second/category',
        name: 'AddSecondCategory',
        meta: { title: '添加二级分类' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/add/AddSecondCategory')
      },
      {
        path: '/add/product',
        name: 'AddProduct',
        meta: { title: '添加产品' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/add/AddProduct')
      }
    ]
  },
  {
    path: '/web',
    component: WebLayout,
    redirect: '/web',
    hidden: true,
    children: [
      {
        path: '/search',
        name: 'Search',
        meta: { title: '搜索页' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/web/Search')
      },
      {
        path: '/to/:id',
        name: 'ProductDefault',
        meta: { title: '卓一' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/web/ProductDefault')
      },
      {
        path: '/web',
        name: 'index',
        meta: { title: '首页' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/web/index')
      },
      {
        path: '/trademark',
        name: 'Trademark',
        meta: { title: '商标服务' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/web/Trademark')
      },
      {
        path: '/patent',
        name: 'Patent',
        meta: { title: '专利服务' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/web/Patent')
      },
      {
        path: '/copyright',
        name: 'Copyright',
        meta: { title: '版权服务' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/web/Copyright')
      },
      {
        path: '/product/list/:fid/:id',
        name: 'ProductList',
        meta: { title: '服务列表' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/web/ProductList')
      },
      {
        path: '/product/detail/:id',
        name: 'ProductDetail',
        meta: { title: '服务详情' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/web/ProductDetail')
      },
      {
        path: '/order/ordinary',
        name: 'OrdinaryPay',
        meta: { title: '支付信息' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/web/OrdinaryPay')
      },
      {
        path: '/order/pay/:no',
        name: 'Pay',
        meta: { title: '支付方式' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/web/Pay')
      }
    ]
  },
  {
    path: '/tui',
    component: TuiLayout,
    redirect: '/tui',
    children: [
      {
        path: '/tui/sbzc',
        name: 'sbzc',
        meta: { title: '商标注册' },
        hidden: true,
        component: () => import(/* webpackChunkName: "user" */ '@/views/tui/sbzc/index')
      }
    ]
  },
  {
    path: '/user/explain',
    name: 'Explain',
    meta: { title: '服务条款' },
    hidden: true,
    component: () => import(/* webpackChunkName: "user" */ '@/views/user/Explain')
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/404')
  }
]
